/*
 * @Author: 张小平
 * @Date:   2025-05-01 
 * @Email:  qqshuqian@163.com 
 * @Copyright © 2024 aseyun. All rights reserved.
 */

import request from '@/framework-core/axios'
import website  from '@/framework-core/config/website';

/**
 * 获取所有的菜单
 */
export function fetchMenuTree(params) {
  return request({
    url: website.baseUrl+'/api/sys/menu/tree',
    method: 'get',
    params: params
  })
}

/**
 * 获取管理菜单
 */
export function fetchMenuTreeByMng(params) {
  return request({
    url: website.baseUrl+'/api/sys/roleMenu/tree',
    method: 'get',
    params: params
  })
}

/**
 * 获角色菜单
 */
export function fetchMenuByRoleId(role) {
  return request({
    url: website.baseUrl+'/api/sys/roleMenu/getMenuByRoleId/'+role,
    method: 'get'
  })
}


export function permissionUpdateRoleMenu(roleId, menuIds) {
  return request({
    url: website.baseUrl+'/api/sys/roleMenu/set',
    method: 'post',
    params: {
      roleId:roleId,
      menuIds: menuIds
    }
  })
}






export function getMenu(type = 0,parentId =-1) {
  return request({
    url: website.baseUrl+'/sys/menu/user',
    method: 'get',
    params: {
      type,
      parentId
    }
  })
}
/**
 * 获取用户的所有顶部菜单
 */
export function getTopMenu() {
  return request({
    url: website.baseUrl+'/sys/menu/user',
    method: 'get',
    params: {type: 'top'},
  })
}


